package com.atguigu.dao.impl;

import com.atguigu.Bean.C_user;
import com.atguigu.dao.UserDao;

public class UserDaoImpl extends BaseDao implements UserDao {

    @Override
    public C_user queryUserByUsername(String username) {
        String sql="select `id`,`username`,`password` from c_user where username=?";
        return querydate(C_user.class,sql,username);
    }

    @Override
    public int saceUser(C_user user) {
        String sql="insert into c_user (`username`,`password`,`email`,`realname`,`user_ID`,`sex`) values (?,?,?,?,?,?);";
        return updatedate(sql,user.getUsername(),user.getPassword(),user.getEmail(),user.getRealname(),user.getUser_ID(),user.getSex());
    }

    @Override
    public C_user queryUserByUsernameAndPassword(String username, String password) {
        String sql="select `id`,`username`,`password` from c_user where username=? and password=?";
        return querydate(C_user.class,sql,username,password);
    }
}
